home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 March
/
CMCD0305.ISO
/
Software
/
Shareware
/
Utilitare
/
emu
/
Emu8086_Setup_307c.exe
/
{app}
/
Samples
/
pages.asm
< prev
next >
Wrap
Assembly Source File
|
2002-08-02
|
1KB
|
93 lines
; This example demonstrates
; the use of pages (double-buffering).
; This program uses first 4 pages of
; video memory by setting some data
; on them, and waits for any key,
; pressing any key will show all
; pages one after another.
#make_COM#
ORG 100h
; set video mode:
; Text mode 40x25, 16 colors, 8 pages
MOV AH, 0
MOV AL, 0
INT 10h
; ======== print chars on different pages:
MOV AL, '0' ; char to print.
MOV BH, 0 ; page number.
do_print:
MOV BL, 01001111b ; attributes.
MOV CX, 1018 ; number of chars to write.
MOV AH, 09h ; write char function.
INT 10h
INC AL ; next char.
INC BH ; next page.
CMP AL, '4'
JB do_print
; ===== modify pages by writing directly
; to video memory:
PUSH DS
MOV AX, 0B800h
MOV DS, AX
; First byte is a color attribute
; (0F2h = white background, green char),
; second byte is an ASCII code
; (41h = 'A', 42h = 'B', 43h = 'C'...)
MOV DI, 0 ; page 0.
MOV w.[DI], 0F241h
ADD DI, 4096 ; page 1.
MOV w.[DI], 0F242h
ADD DI, 4096 ; page 2.
MOV w.[DI], 0F243h
ADD DI, 4096 ; page 3.
MOV w.[DI], 0F244h
POP DS
; ======= show pages one after another:
MOV AL, 0 ; page number
show_next_page:
MOV AH, 05h ; change page function.
INT 10h
PUSH AX
; wait for any key:
XOR AX, AX
INT 16h
POP AX
INC AL
CMP AL, 4
JB show_next_page
RET ; return to OS.
;==============================
END